* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* Navigation */
.main-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0 30px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: #333;
    font-weight: 700;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-link {
    display: block;
    padding: 20px 25px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Main Content */
main {
    padding: 30px;
}

.page {
    display: block;
}

.page.hidden {
    display: none;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
}

/* Month Selector */
.month-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
}

.month-selector button {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.month-selector button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: none;
}

.month-selector span {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 150px;
    text-align: center;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.amount {
    font-size: 2.2rem;
    font-weight: 700;
    color: #4CAF50;
}

.amount.spent {
    color: #f44336;
}

.amount.income {
    color: #4CAF50;
}

.amount.remaining {
    color: #2196F3;
}

.progress-container {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e1e5e9;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.progress-fill.over-budget {
    background: #f44336;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.chart-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.chart-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

canvas {
    max-height: 300px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: auto;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e1e5e9;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
}

.btn-danger {
    background: #f44336;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: auto;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-secondary:hover {
    border-color: #667eea;
    color: #667eea;
}

/* Filters */
.filters-section {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group input,
.filter-group select {
    padding: 10px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    flex: 1;
}

/* Tables */
.table-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.table-card h2 {
    margin-bottom: 20px;
    color: #333;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

tr:hover {
    background-color: #f8f9fa;
}

.delete-btn,
.edit-btn {
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    border: none;
    margin-right: 5px;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.delete-btn:hover {
    background: #d32f2f;
}

.edit-btn:hover {
    background: #1976D2;
}

/* Budget Envelopes */
.budget-envelopes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.envelope {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.envelope:hover {
    transform: translateY(-5px);
}

.envelope-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.envelope-category {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.envelope-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4CAF50;
}

.envelope-progress {
    margin: 15px 0;
}

.envelope-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.envelope-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-top: 10px;
}

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.account-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.account-card:hover {
    transform: translateY(-5px);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.account-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.account-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.account-balance {
    font-size: 1.8rem;
    font-weight: 700;
    color: #4CAF50;
    text-align: center;
    margin: 20px 0;
}

.account-balance.negative {
    color: #f44336;
}

/* Settings */
.settings-sections {
    display: grid;
    gap: 30px;
}

.settings-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.settings-card h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.rules-list {
    margin-bottom: 20px;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.rule-info {
    flex: 1;
}

.rule-keyword {
    font-weight: 600;
    color: #333;
}

.rule-category {
    color: #666;
    font-size: 0.9rem;
}

.data-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 25px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0;
    }

    main {
        padding: 20px;
    }

    .main-nav {
        flex-direction: column;
        padding: 15px;
    }

    .nav-links {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        padding: 15px 20px;
    }

    .page-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .filters-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-group {
        flex-direction: column;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .budget-envelopes,
    .accounts-grid {
        grid-template-columns: 1fr;
    }

    .data-actions {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 10px 8px;
    }
}